package com.dave.sleuth.gatewayservice.filter

import brave.Tracer
import com.netflix.zuul.ZuulFilter
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants
import org.springframework.stereotype.Component

/**
 * Created by mac on 2018/5/30
 * Describes
 */
@Component
class LoggerFilter: ZuulFilter() {
    @Autowired
    val tracer: Tracer? = null;
    override fun run(): Any {
        tracer.
        tracer.addTag("operator","forezp");
        System.out.print(tracer.getCurrentSpan().traceIdString());
        return null;
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun shouldFilter(): Boolean {
        return true
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun filterType(): String {
        return FilterConstants.POST_TYPE
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun filterOrder(): Int {
        return 900
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

}